﻿using Architecture.API.Application.TraceabilityCommand.DeepProcessingCommand;
using MediatR;
using Traceability.Domain.Service.DeepProcessingServices;
using Traceability.Domain.TraceabilityDto;

namespace Architecture.API.Application.TraceabilityCommandHandler.DeepProcessingCommandHandler
{
    public class ShowDeepProcessingCommandHandler : IRequestHandler<ShowDeepProcessingCommand, List<DeepProcessingDto>>
    {
        /// <summary>
        /// 深加工服务
        /// </summary>
        protected readonly IDeepProcessingService deepProcessingService;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="deepProcessingService">深加工服务</param>
        public ShowDeepProcessingCommandHandler(IDeepProcessingService deepProcessingService)
        {
            this.deepProcessingService = deepProcessingService;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<List<DeepProcessingDto>> Handle(ShowDeepProcessingCommand request, CancellationToken cancellationToken)
        {
            return await deepProcessingService.GetAllDeepProcessingList(request.shoppingId);
        }
    }
}
